import { useState,useEffect } from 'react'
import axios from 'axios'
import Address from './Address'

function App() {
  const [address,setAddress] = useState([]);
  

  useEffect(function() {
    // console.log('----');
    (async function getUserAddress(){
      const {data} = await axios.get('https://www.fastmock.site/mock/759aba4bef0b02794e330cccc1c88555/beers/address');
        if(data&&data.length>0){
          setAddress([...data]);
        }
      })()
    },[])
  return (
    <div className="App">
      <Address address={address}/>
    </div>
  )
}

export default App
